home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1994 April / 1994-04b.d64 / directory mgr (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  4KB  |  134 lines

  1. 5 rem copyright 1994 - compute publications intl ltd - all rights reserved
  2. 10 rem  directory manager v1.0/930315
  3. 20 poke53280,11:poke53281,0:poke650,128:goto7000
  4. 50 i$=ar$(x1,.):ar$(x1,.)=ar$(x2,.):ar$(x2,.)=i$:i$=ar$(x1,1)
  5. 60 ar$(x1,1)=ar$(x2,1):ar$(x2,1)=i$:return:rem swap
  6. 70 get#15,s$:ifs$="0"thenreturn
  7. 80 print"[147]disk error:[146] ";
  8. 90 prints$;:ifs$<>chr$(13)thenget#15,s$:goto90
  9. 100 close8:close15:end
  10. 110 clr:dimi$,j$,k$,i,j,p,m,x1,x2,pg,s,s$,qt$,mt$,dl$,bl$,ar$(144,1)
  11. 120 s$=chr$(0):fori=1to16:mt$=mt$+chr$(160):next:fori=1to19:bl$=bl$+" ":next
  12. 121 qt$=chr$(34):dl$=s$+s$+s$+mt$:fori=1to11:dl$=dl$+s$:next
  13. 122 j$="12345678":j$=j$+j$:i$=left$(j$,3):k$=left$(j$,11)
  14. 130 print"[147]"tab(7)"*** reading directory ***"
  15. 140 open15,8,15,"i0":open8,8,8,"#":s=1:m=0
  16. 150 print#15,"u1";8;0;18;s:gosub70
  17. 160 fori=0to7:print#15,"b-p";8;i*32+2
  18. 170 j=usr(.):ifjthen190
  19. 180 m=m+1:ar$(m,1)=i$+k$:ar$(m,.)=j$
  20. 190 next
  21. 200 print#15,"b-p";8;0:get#8,s$:ifs$=""thenget#8,s$:s=asc(s$):goto150
  22. 210 close8:close15:ifm=0thenprint"[147]no files in directory.":end
  23. 220 p=1:gosub5000
  24. 230 gosub6000
  25. 240 poke214,p-pg:print:print">[157]";
  26. 250 ifpeek(198)=0then250
  27. 260 geti$:ifi$=""then400
  28. 270 ifi$="[145]"then430
  29. 280 ifi$=""then380
  30. 290 ifi$=chr$(13)then500
  31. 300 ifi$="+"then460
  32. 310 ifi$="-"then480
  33. 320 ifi$="s"then760
  34. 330 ifi$="w"then800
  35. 340 ifi$="r"then110
  36. 350 ifi$="e"then610
  37. 360 ifi$="q"thenprint"[147]";:end:goto220
  38. 370 goto250
  39. 380 ifp<>pgthenp=pg:print" ":goto240
  40. 390 p=1:goto230
  41. 400 print" ":p=p+1:ifp>mthenp=m:goto240
  42. 410 ifp>pg+22then230
  43. 420 goto240
  44. 430 print" ":p=p-1:ifp<1thenp=1:goto240
  45. 440 ifp<pgthen230
  46. 450 goto240
  47. 460 print" ":p=pg+23:ifp>mthenp=m
  48. 470 goto230
  49. 480 print" ":p=pg-23:ifp<1thenp=1
  50. 490 goto230
  51. 500 poke214,p-pg:print:print">"qt$ar$(p,.)qt$"[145]"
  52. 510 ifpeek(198)=0then510
  53. 520 geti$:ifi$<>""andi$<>"[145]"andi$<>chr$(13)then510
  54. 530 print" [145]":ifi$=chr$(13)thenprint" "qt$ar$(p,.)qt$:goto240
  55. 540 ifi$=""then580
  56. 550 ifp=1then500
  57. 560 x1=p:p=p-1:x2=p:gosub50:ifp<pgthengosub6000:goto500
  58. 570 printbl$"[145]":print" "qt$ar$(p+1,.)qt$:poke214,p-pg:print:printbl$:goto500
  59. 580 ifp=mthen500
  60. 590 x1=p:p=p+1:x2=p:gosub50:ifp>pg+22thengosub6000:goto500
  61. 600 printbl$"[145]":print" "qt$ar$(p-1,.)qt$:poke214,p-pg:print:printbl$:goto500
  62. 610 poke214,14:print:print,," edit filename":j$=ar$(p,.)
  63. 620 i=0
  64. 630 poke214,16:print:print,,qt$j$qt$" ":j=len(j$)
  65. 640 printspc(20+i)" [163] [145]"
  66. 650 ifpeek(198)=0then650
  67. 660 geti$:ifi$=""andi<>len(j$)theni=i+1:goto640
  68. 670 ifi$="[157]"andi>0theni=i-1:goto640
  69. 680 if(asc(i$)and127)=19thenj$="":poke214,16:print:print,,bl$:print,,bl$:goto620
  70. 690 ifasc(i$)=20andithenj$=left$(j$,i-1)+right$(j$,j-i):i=i-1:goto630
  71. 700 ifasc(i$)=148andj<16thenj$=left$(j$,i)+" "+right$(j$,j-i):goto630
  72. 710 ifasc(i$)=13andj$<>""thenar$(p,.)=j$:gosub5000:goto230
  73. 720 ifasc(i$)=13thengosub5000:goto230
  74. 730 if(asc(i$)and96)=0ori>15then650
  75. 740 ifi=jthenj$=j$+i$:i=i+1:goto630
  76. 750 j$=left$(j$,i)+i$+right$(j$,j-i-1):i=i+1:goto630
  77. 760 print" ":poke214,13:print:print,,"   ** sorting **":ifm<3then220
  78. 770 forx1=1tom-1:x2=x1:fori=x2tom:ifar$(i,.)<ar$(x2,.)thenx2=i
  79. 780 next:ifx2>x1thengosub50
  80. 790 next:goto220
  81. 800 poke214,14:print:print,," write directory!"
  82. 810 print,," *are you sure? y/n"
  83. 820 ifpeek(198)=0then820
  84. 830 geti$:ifi$="n"then220
  85. 840 ifi$<>"y"then820
  86. 850 print"[147]"tab(7)"*** writing directory ***"
  87. 860 printtab(11)"[163][163][163][163][163][163][163] [163][163][163][163][163][163][163][163][163]":open15,8,15,"i0"
  88. 870 restore:open8,8,8,"#":p=0:s=1
  89. 880 fori=0to7:print#15,"b-p";8;i*32+2
  90. 890 p=p+1:ifp>mthenprint#8,dl$;:goto920
  91. 900 print#8,left$(ar$(p,1),3)ar$(p,.)right$(mt$,16-len(ar$(p,.)));
  92. 910 print#8,right$(ar$(p,1),11);
  93. 920 next:i=s:print#15,"b-p";8;0:ifp<mthenreads:print#8,"";chr$(s);
  94. 930 ifp<mthenprint#15,"u2";8;0;18;i:gosub70:goto880
  95. 940 print#8,chr$(0);chr$(255);:print#15,"u2";8;0;18;i
  96. 950 close8:close15:goto220
  97. 5000 print"[147]",," directory manager"
  98. 5010 print,," by steven w. reid"
  99. 5020 print,," use cursor keys to"
  100. 5030 print,," move, return to"
  101. 5040 print,," pick up/drop file."
  102. 5050 print,," r- read directory"
  103. 5060 print,," w- write directory"
  104. 5070 print,," e- edit filename"
  105. 5080 print,," s- sort directory"
  106. 5090 print,," q- quit program"
  107. 5100 return
  108. 6000 print"":pg=int((p-1)/23)*23+1:fori=pgtopg+22
  109. 6010 printbl$"[145]":ifi<=mthenprint" "qt$ar$(i,.)qt$;
  110. 6020 print:next:poke198,0:return
  111. 7000 restore:fori=0to-1step0:readi:next:a=828:c=0
  112. 7010 readd:c=c+d:ifd=>0thenpokea,d:a=a+1:goto7010
  113. 7020 ifcthenprint"data error":end
  114. 7030 poke785,60:poke786,3:goto110
  115. 9000 data 4,7,10,13,16,2,5,8,11,14,17,3,6,9,12,15,18,-1
  116. 10000 data 160,002,177,045,153,096,000
  117. 10001 data 200,192,005,208,246,162,008
  118. 10002 data 032,198,255,160,000,032,207
  119. 10003 data 255,208,009,032,204,255,169
  120. 10004 data 001,168,076,145,179,145,099
  121. 10005 data 200,032,207,255,145,099,200
  122. 10006 data 032,207,255,145,099,160,009
  123. 10007 data 177,045,153,089,000,200,192
  124. 10008 data 012,208,246,160,000,032,207
  125. 10009 data 255,145,099,200,192,016,208
  126. 10010 data 246,136,177,099,201,160,208
  127. 10011 data 003,136,016,247,200,152,160
  128. 10012 data 009,145,045,160,016,177,045
  129. 10013 data 153,082,000,200,192,019,208
  130. 10014 data 246,160,000,032,207,255,145
  131. 10015 data 099,200,192,011,208,246,032
  132. 10016 data 204,255,169,000,168,076,145
  133. 10017 data 179,-16185
  134.